package com.mz.ozy.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mz.ozy.R;
import com.mz.ozy.bean.BalanceDetailBean;
import com.mz.ozy.utils.Utils;

import java.util.List;

/**
 *
 */

public class RedeRecordAdapter extends BaseQuickAdapter<BalanceDetailBean.PageBean.PageItemsBean, BaseViewHolder> {
    public RedeRecordAdapter(List<BalanceDetailBean.PageBean.PageItemsBean> data) {
        super(R.layout.item_redemption_detail, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BalanceDetailBean.PageBean.PageItemsBean item) {
        if (!TextUtils.isEmpty(item.getDamt())) {
            final double rate = Double.parseDouble(item.getDamt());
            helper.setText(R.id.tv_usdt_num, "-" + Utils.subTwoNumber(rate));
        } else {
            helper.setText(R.id.tv_usdt_num, "-" + 0.00);
        }
        if (!TextUtils.isEmpty(item.getAmt())) {
            final double rate = Double.parseDouble(item.getAmt());
            helper.setText(R.id.tv_exchange_num, "+" + Utils.subTwoNumber(rate));
        } else {
            helper.setText(R.id.tv_exchange_num, "+" + 0.00);
        }
        helper.setText(R.id.tv_date, item.getCreated());
    }
}
